<?
$sub_menu = "700300";
include_once("./_common.php");

auth_check($auth[$sub_menu], "r");

$token = get_token();

$g4[title] = "메일전송 내역";
include_once("./admin.head.php");
if($bo_table == 'infoMail') //opt:2 이면 정보공개서 메일내역
	$sub = "where opt = 2";
else 
	$sub = "where opt = 1"; //opt:1 이면 가맹점관리 메일내역
/*--- 페이징 ---*/
$sql0 = "select count(*) as cnt from info_mail ".$sub;
$row0 = sql_fetch($sql0);
$total_count = $row0['cnt'];

$rows = 10;
$total_page = ceil($total_count / $rows);
if($page == "") $page = 1;
$from_record = ($page -1) * $rows;

$sqlp = "select * from info_mail $sub limit $from_record, $rows ";
$result = sql_query($sqlp);
$pagelist = get_paging2($rows, $page, $total_page, "$_SERVER[PHP_SELF]?$qstr&page=");


/*--- 리스트 출력 ---*/
$sql2 = "select * from info_mail $sub order by id DESC limit $from_record, $rows";
$rst2 = sql_query($sql2);
while($row2 = mysql_fetch_assoc($rst2)) {
	$li[] = $row2;
}

$write_pages = get_paging($config[cf_write_pages], $page, $total_page, "./mail_record.php?bo_table=$bo_table".$qstr."&page=");


?>
<br />
<style>
div.select_store_wrap {text-align:left}
table.p_t {width:100%}
table.p_t tr {line-height:24px;}
table.p_t th {background:url(/test/manage/imgs/tit_bg.gif) repeat-x;height:38px;color:white;line-height:16px;font-weight:normal;}
table.p_t th {border-bottom:1px solid #CCCCCC}
table.p_t td {border-bottom:none;}
table.p_t td {text-align:center;height:30px;}
table.p_t td a {color:black}
.mb15 {margin-bottom:15px;}


</style>
<?=subtitle("메일전송 내역")?>

<div class="ba_list">
	<table class="board_list" cellpadding="0" cellspacing="0" style="text-align: center">
		<col width="20"/>
		<col width="150" />
	    <col width="150" />
	    <col width="250" />
	    <col width="200" />
		<tr>
		<th></th>
		<th>보낸사람</th>
		<th>받는사람</th>
		<th>전송 시간</th>
		<th>받는사람 메일주소</th>
		</tr>
		<?php
		for($i = 0; $i < count($li); $i += 1) {
			$bg = $i%2 ? 0 : 1;
		?>
		<tr class="bg<?=$bg?>">
		<td><?php// echo count($li) - $i;?></td>
		<td><?php echo $li[$i]['im_mname']?></td>
		<td><?php echo $li[$i]['im_toname']?></td>
		<td><?php echo $li[$i]['im_time']?></td>
		<td><?php echo $li[$i]['im_toaddr']?></td>
		</tr>
		<? } ?>
		
	</table>
</div>
	<div class="re_list">
	</div>
	<div style="float:right">
		<?php if($is_admin) { ?>
			<a href="<?php echo $write_href ?>"><img src="./img_btn/btn_write.gif" alt="글쓰기" /></a>
		<? } ?>
	</div>
	<!-- 페이지 -->
    <div class="board_page" >
        <? if ($prev_part_href) { echo "<a href='$prev_part_href'><img src='./img_btn/page_search_prev.gif' border='0' align=absmiddle title='이전검색'></a>"; } ?>
       
        <?
        // 기본으로 넘어오는 페이지를 아래와 같이 변환하여 이미지로도 출력할 수 있습니다.
        //echo $write_pages;
        $write_pages = str_replace("처음", "<img src='./img_btn/page_begin.gif' border='0' align='absmiddle' title='처음'>", $write_pages);
        $write_pages = str_replace("이전", "<img src='./img_btn/page_prev.gif' border='0' align='absmiddle' title='이전'>", $write_pages);
        $write_pages = str_replace("다음", "<img src='./img_btn/page_next.gif' border='0' align='absmiddle' title='다음'>", $write_pages);
        $write_pages = str_replace("맨끝", "<img src='./img_btn/page_end.gif' border='0' align='absmiddle' title='맨끝'>", $write_pages);
        //$write_pages = preg_replace("/<span>([0-9]*)<\/span>/", "$1", $write_pages);
        $write_pages = preg_replace("/<b>([0-9]*)<\/b>/", "<b><span style=\"color:#4D6185; font-size:12px; text-decoration:underline;\">$1</span></b>", $write_pages);
        ?>
        <?=$write_pages?>
        <? if ($next_part_href) { echo "<a href='$next_part_href'><img src='./img_btn/page_search_next.gif' border='0' align=absmiddle title='다음검색'></a>"; } ?>
    </div>

<?
include_once("../admin.tail.php");
?>
